<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>事件处理</title>
  <script type="text/javascript" src="/vue/vue.js"></script>
</head>
<body>

  <!-- 
    总结
      1. @click="demo" 和 @click="demo($event)",两者效果是一致的，但是后者可以传参
      2. vue中的方法后面可以不用带括号，不带括号的默认会传一个 event 对象；带括号的可以自定义一些参数
   -->

  <div id="app">
    <button v-on:click="showInfo">不传参</button>
    <button @click="showInfo1($event, 666)">传参</button>
  </div>
  
  <script type="text/javascript">
    const vm =new Vue({
      el: '#app',
      data: {
        name: 'zzm',
      },
      methods: {
        showInfo() {
          console.log(event.target.innerText);
        },
      
        showInfo1(event, number) {
          console.log(event, number);
        }        
      }
    })
  </script>
</body>
</html>